//jmbrinkhus
//Nov 22 2009
//Lou Decroo
//Modified 12-03-2009


public class Question {
	private String content;
	private int numberOfPossibleAns;
	private int type;
	private int qid;
	private String[] possibleAns;
	private Boolean defaultQuestion;

	public Question ()
	{
		content = "";
		numberOfPossibleAns = 2;
		possibleAns = new String[0];
		defaultQuestion = true;
	}
	
	public Question(String contentIn, int typeIn, int cid){
		content = new String(contentIn);
		type = typeIn;
		possibleAns = new String[0];
		if(cid == 0) 
			defaultQuestion = true;
		
		else 
			defaultQuestion = false;
	}
	
	public Question (String contentIn, int typeIn, String [] answers, int cid)
	{
		content = new String(contentIn);
		type = typeIn;
		possibleAns = new String [answers.length];
		setPossibleAns(answers);
		
		
		if(cid == 0) 
			defaultQuestion = true;
		
		else 
			defaultQuestion = false;
	}
	
	/**
	 * Getter for default
	 * @return true if question is default and false otherwise
	 */
	public Boolean isDefault(){
		return defaultQuestion;
	}
	
	public void setDefault(Boolean def){
		defaultQuestion = def;
	}
	
	/**
	 * Getter for question type
	 * @return returns the question type
	 */
	public int getType(){
		return type;
	}
	
	/**
	 * Setter for question type
	 * @param t - this questions type (1(multiple choice) 2(open-ended)
	 */
	public void setType(int t){
		type = t;
	}
	
	/**
	 * Getter for question content
	 * @return returns the content of the question (i.e. the actual question string)
	 */
	public String getContent(){
		return content;
	}
	
	/**
	 * Setter for question content
	 * @param q - set the actual question
	 */
	public void setContent(String q){
		content = q;
	}
	
	/**
	 * Getter for number of answers
	 * @return returns the number of answers to the question
	 */
	public int getNumberAns(){
		return numberOfPossibleAns;
	}
	
	/**
	 * Setter for number of answers
	 * @param i - the number of answers to this question
	 */
	public void setNumberAns(int i){
		numberOfPossibleAns = i;
	}
	
	/**
	 * Getter for possible answers
	 * @return a string of all possible answers to this question
	 */
	public String[] getPossibleAns(){
		return possibleAns;
	}
	
	/**
	 * Setter for possible answers
	 * @param answers - an array of strings containing possible answers to this question
	 */
	public void setPossibleAns(String[] answers){
		int i;
		possibleAns = new String [answers.length];
		for (i = 0; i < answers.length; i++)
		{
			possibleAns[i] = answers[i];
		}
	}
	
	public void setQid (int qidIn)
	{
		qid = qidIn;
	}
	
	public int getQid ()
	{
		return qid;
	}
}